package com.example.administrator.a008listapp;

import android.app.ListActivity;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends ListActivity {

    String data[] = {
            "apple",
            "suanme",
            "Huawei",
            "Xiaomi",
            "nuex 5",
            "Htc",
            "vivo 6",
            "vivo 6",
            "vivo 6",
            "vivo 6",
            "vivo 6",
            "vivo 6",
            "vivo 6",
            "vivo 6",
            "vivo 6",
            "vivo 6",
            "vivo 6",
            "vivo 6",
            "vivo 6",
            "vivo 6",
            "vivo 6"
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.activity_main);

        ArrayAdapter<String> adpater = new ArrayAdapter<String>(
                this,
                android.R.layout.simple_list_item_1,
                data
                );
        setListAdapter(adpater);
    }

    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);
        Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://qq.com"));
        startActivity(i);
    }
}
